package com.czy.workflow.core.selector;

import com.czy.workflow.core.context.FlowContext;
import com.czy.workflow.core.model.FlowBranch;
import com.czy.workflow.core.model.FlowNode;

import java.util.ArrayList;
import java.util.List;

public abstract class AbstractNodeBranchSelector implements NodeBranchSelector{


    public List<FlowNode> getNodesByBranch(FlowContext flowContext, List<FlowBranch> nodeBranches) {
        List<FlowNode> nextNodes = new ArrayList<>();
        for(FlowBranch branch : nodeBranches){
            nextNodes.add(flowContext.getFlowService().getFlowNodeById(branch.getFlowId(), branch.getTargetNodeId()));
        }
        return nextNodes;
    }
}
